<template>
  <div class="dy-main BuyExchangeResult">
    <div class="dy-header">
      <x-header class="header-change" :right-options="{showMore: false}" :left-options="{preventGoBack:true}" @on-click-back="back">购买</x-header>
    </div>
    <div class="dy-body">
      <img v-if="status === '0'" class="statusIcon" src="../../../assets/img/Insurance/fail.png">
      <img v-if="status === '1'" class="statusIcon" src="../../../assets/img/Insurance/success.png">
      <div class="msgInfo" v-if="status === '1'">购买成功</div>
      <div class="msgInfo" v-if="status === '0'">购买失败</div>
      <div class="userInfo">
        <dl>
          <dt>购汇账号</dt>
          <dd>{{ purchasingNumber }}</dd>
        </dl>
        <dl>
          <dt>购汇金额(美元)</dt>
          <dd>{{ purchasingAmount }}</dd>
        </dl>
        <dl>
          <dt>本次购汇折合人民币</dt>
          <dd>{{ purchasingRMB }}</dd>
        </dl>
        <dl>
          <dt>本年度剩余购汇额度</dt>
          <dd>{{ purchasingLimit }}</dd>
        </dl>
        <dl>
          <dt>入账账号</dt>
          <dd>{{ billingAccount }}</dd>
        </dl>
        <div v-for="(item, index) in lists" :key="index">{{ item.name }}</div>
        <div v-for="(item, index) in testlists" :key="index">{{ item.name }}</div>
      </div>
      <div class="goToNext" @click="gotoNext('ExchangeRateHome')">继续购买</div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      lists: '',
      testlists: '',
      status: '1',
      purchasingNumber: '1111 **** **** 2222',
      purchasingAmount: '445.00',
      purchasingRMB: '2,345.00',
      purchasingLimit: '20,000.00美元',
      billingAccount: ''
    }
  },
  methods: {
    back () {
      this.$publicFun.goBack(this)
    },
    gotoNext (name) {
      this.$router.push({path: name})
    },
    refreshTest () {
      let LVm = this
      this.$bridge.callhandler('nativeRequest',
        JSON.stringify({'requstSource': 'internetRequest', 'url': 'http://whichat.icitic.net/mstep/mstep.do?act=business', 'params': {'method_Name': 'M0401010', 'basic_Data': {'PayAccount': '6217298009765555', 'BuyAmt': '2001'}}}),
        function (response) {
          response = JSON.parse(response)
          if (response.status === 0 || response.status === '0') {
            LVm.prdList = response.data.data
          } else {
            LVm.aaa = response.data.data
          }
        }
      )
      // this.$router.push({name: 'FinancialBuySure', query: {'PayAccount': '6217298009765555', 'BuyAmt': '2001'}})
    }
  },
  computed: {
    getCstNameqq () {
      return this.$store.getters.getCstName
    },
    getCstid () {
      return this.$store.getters.getCstId
    },
    getL () {
      return this.$store.getters.getList
    },
    getO () {
      return this.$store.getters.getObj
    }
  },
  created () {
    // this.$('.header-change')[0].html('jhgfghjk')
    let name = this.getCstNameqq
    let id = this.getCstid
    this.lists = this.getL
    let OBJ = this.getO[1].name1
    this.billingAccount = this.$route.query.PayAccount
    this.testlists = this.$route.query.testList
    console.error(`--------name:${name}---id:${id}----obj:${OBJ}`)
    this.refreshTest()
  }
}
</script>

<style lang="less">
.BuyExchangeResult{
  .dy-body{
    background: #fff;
    .statusIcon{
      height: 1.08rem;
      width: 1.08rem;
      margin: 1.45rem 3.2rem 0.27rem;
    }
    .msgInfo{
      font-size: 0.3rem;
      font-weight: bolder;
      text-align: center;
    }
    .userInfo{
      margin: 0.77rem 0.3rem;
      background: #FAFAFA;
      border-radius: 0.2rem;
      padding: 0.2rem 0;
      dl{
        display: flex;
        font-size: 0.28rem;
        height: 0.6rem;
        line-height: 0.6rem;
        padding: 0 0.26rem;
        >dt{
          flex: 1;
          text-align: left;
          color: #999999;
        }
        >dd{
          flex: 1;
          text-align: right;
          color: #333333;
        }
      }
    }
    .goToNext{
      height: 0.88rem;
      width: 3rem;
      margin: 0 auto;
      background: #EC1B30;
      border-radius: 0.06rem;
      color: #fff;
      line-height: 0.88rem;
      text-align: center;
      font-size: 0.34rem;
    }
  }
}
</style>
